﻿using System;
using Apworks.Events;

namespace TinyForum.Domain.Events
{
    /// <summary>
    /// Represents the base class for all the domain events in Tiny Forum.
    /// </summary>
    public abstract class TinyForumDomainEvent : DomainEvent
    {
        #region Ctor
        /// <summary>
        /// Initializes a new instance of <c>TinyForumDomainEvent</c> class.
        /// </summary>
        public TinyForumDomainEvent()
            : base()
        {
            this.Timestamp = DateTime.UtcNow;
        }
        #endregion

        #region Public Properties
        /// <summary>
        /// Gets a <see cref="System.String"/> value which represents the intent of the current
        /// domain event.
        /// </summary>
        public virtual string Intent
        {
            get
            {
                return string.Format("Event {0} occurred at {1}, local time: {2}",
                    this.GetType().FullName, this.Timestamp, this.Timestamp.ToLocalTime());
            }
        }
        #endregion
    }
}
